<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http:www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<include file="Common:cssjs" />
</head>
<body>
<include file="Category:nav" />
<style type="text/css">
	html{_overflow-y:scroll}
</style>
<script type="text/javascript"> 
	$(function(){
		$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true}, function(){this.close();$(obj).focus();})}});
		$("#modelid").formValidator({onshow:"请选择模型",onfocus:"请选择模型",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请选择模型"}).defaultPassed();
		$("#catname").formValidator({onshow:"请输入栏目名称",onfocus:"请输入栏目名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入栏目名称"}).defaultPassed();
		$("#url").formValidator({onshow:" ",onfocus:"域名可为空，格式应该为http://www.abc3210.com/",tipcss:{width:'300px'},empty:true}).inputValidator({onerror:"域名可为空，格式应该为http://www.abc3210.com/"}).regexValidator({regexp:"http:\/\/(.+)\/$",onerror:"格式应该为http://www.abc3210.com/，请以'/'结束"});
        $("#catdir").formValidator({onshow:"请输入目录名称",onfocus:"请输入目录名称"}).regexValidator({regexp:"^([a-zA-Z0-9、-]|[_]){0,30}$",onerror:"目录名称必须为字母、数字、下划线、中划线"}).inputValidator({min:1,onerror:"请输入目录名称"}).ajaxValidator({
			type : "get",
			url : "",
			data :"g=Admin&m=Category&a=public_check_catdir",
			datatype : "json",
			cached:false,
			getdata:{
				parentid:'parentid',
				parentdir:'parentdir',
				old_catdir:'old_catdir',
				old_parentdir:'old_parentdir'
				//如果是编辑，还要提供，旧的父目录old_parentdir，旧的栏目目录old_catdir
			},
			async:'false',
			success : function(data){	
			     if( data.status ){
					 return true;
				 }else{
					 return false;
				}
			},buttons: $("#dosubmit"),onerror : "目录名称已存在",onwait : "正在连接，请稍候。"}).defaultPassed();
	})
</script>
<form name="myform" id="myform" action="{:U("Category/edit")}" method="post">
<div class="pad-10">
  <div class="col-tab">
  <ul class="tabBut cu-li">
    <li id="tab_setting_1" class="on" onClick="SwapTab('setting','on','',6,1);">基本属性</li>
    <li id="tab_setting_2" onClick="SwapTab('setting','on','',6,2);">选项设置</li>
    <li id="tab_setting_3" onClick="SwapTab('setting','on','',6,3);">模板设置</li>
  </ul>
  <div id="div_setting_1" class="contentList pad-10">
    <table width="100%" class="table_form ">
      <tr>
        <th width="200">请选择模型：</th>
        <td><select name="info[modelid]" id="modelid" onChange="change_tpl(this.value)">
            <option value='' selected>请选择模型</option>
            <volist name="models" id="vo">
            <option value="{$vo.modelid}" <if condition="$vo['modelid'] eq $data['modelid']">selected</if>>{$vo.name}</option>
            </volist>
          </select></td>
      </tr>
      <tr>
        <th width="200">上级栏目：</th>
        <td><select name="info[parentid]" id="parentid">
            <option value='0'>≡ 作为一级栏目 ≡</option>
            {$category}
          </select></td>
      </tr>
      <tr>
        <th>栏目名称：</th>
        <td><span id="normal_add">
          <input type="text" name="info[catname]" id="catname" class="input-text" value="{$data.catname}">
          </span> </td>
      </tr>
      <tr id="catdir_tr">
        <th>英文目录：</th>
        <td><input type="text" name="info[catdir]" id="catdir" class="input-text" value="{$data.catdir}">
        <input type="hidden" name="old_catdir" id="old_catdir" class="input-text" value="{$data.catdir}">
        <input type="hidden" name="old_parentdir" id="old_parentdir" class="input-text" value="{$data.parentdir}"></td>
      </tr>
      <tr>
        <th>栏目缩略图：</th>
        <td>
          <?php echo Form::images('info[image]', 'image', $data['image'], 'content');?>
          </td>
      </tr>
      
      <tr>
        <th>栏目简介：</th>
        <td><textarea name="info[description]" maxlength="255" style="width:300px;height:60px;">{$data.description}</textarea></td>
      </tr>
      <tr>
      <th width="200">栏目生成Html：</th>
      <td><input type="radio" onClick="$('#category_php_ruleid').css('display','none');$('#category_html_ruleid').css('display','');$('#tr_domain').css('display','');" value="1" name="setting[ishtml]" <if condition="$setting['ishtml'] eq '1' ">checked</if>/>
        是&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="radio" onClick="$('#category_php_ruleid').css('display','');$('#category_html_ruleid').css('display','none');$('#tr_domain').css('display','none');"  value="0" name="setting[ishtml]" <if condition="$setting['ishtml'] eq '0' ">checked</if>/>
        否 </td>
    </tr>
    <tr>
      <th>内容页生成Html：</th>
      <td><input type="radio" onClick="$('#show_php_ruleid').css('display','none');$('#show_html_ruleid').css('display','')" value="1" name="setting[content_ishtml]" <if condition="$setting['content_ishtml'] eq '1' ">checked</if>/>
        是&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="radio" onClick="$('#show_php_ruleid').css('display','');$('#show_html_ruleid').css('display','none')"  value="0" name="setting[content_ishtml]" <if condition="$setting['content_ishtml'] eq '0' ">checked</if>/>
        否 </td>
    </tr>
    <tr>
      <th>栏目页URL规则：</th>
      <td><div style="<if condition="$setting['ishtml'] eq '1' ">display:none</if>" id="category_php_ruleid">
         {$category_php_ruleid}
        </div>
        <div style="<if condition="$setting['ishtml'] eq '0' ">display:none</if>" id="category_html_ruleid">
          {$category_html_ruleid}
        </div></td>
    </tr>
    <tr>
      <th>内容页URL规则：</th>
      <td><div style="<if condition="$setting['content_ishtml'] eq '1' ">display:none</if>" id="show_php_ruleid">
          {$show_php_ruleid}
        </div>
        <div style="<if condition="$setting['content_ishtml'] eq '0' ">display:none</if>" id="show_html_ruleid">
          {$show_html_ruleid}
        </div></td>
    </tr>
      <tr style="<if condition="$setting['ishtml'] eq '0' ">display:none</if>" id="tr_domain">
        <th>绑定域名：</th>
        <td><input type="text" name="info[url]" id="url" class="input-text" size="50" value="{$data.domain}"></td>
      </tr>
    </table>
  </div>
  <div id="div_setting_2" class="contentList pad-10 hidden">
    <table width="100%" class="table_form ">
      <tr>
        <th width="200">是否在导航显示：</th>
        <td><input type='radio' name='info[ismenu]' value='1' <if condition="$data['ismenu'] eq '1' ">checked</if>>
          是&nbsp;&nbsp;&nbsp;&nbsp;
          <input type='radio' name='info[ismenu]' value='0'  <if condition="$data['ismenu'] eq '0' ">checked</if>>
          否</td>
      </tr>
      <tr>
        <th>显示排序：</th>
        <td><input type="text" name="info[listorder]" id="listorder" class="input-text" value="{$data.listorder}"></td>
      </tr>
      <tr>
        <th ><strong>META Title（栏目标题）</strong><br/>
          针对搜索引擎设置的标题</th>
        <td><input name='setting[meta_title]' type='text' id='meta_title' value='{$data['setting']['meta_title']}' size='60' maxlength='60'></td>
      </tr>
      <tr>
        <th ><strong>META Keywords（栏目关键词）</strong><br/>
          关键字中间用半角逗号隔开</th>
        <td><textarea name='setting[meta_keywords]' id='meta_keywords' style="width:90%;height:40px">{$data['setting']['meta_keywords']}</textarea></td>
      </tr>
      <tr>
        <th ><strong>META Description（栏目描述）</strong><br/>
          针对搜索引擎设置的网页描述</th>
        <td><textarea name='setting[meta_description]' id='meta_description' style="width:90%;height:50px">{$data['setting']['meta_description']}</textarea></td>
      </tr>
    </table>
  </div>
  <div id="div_setting_3" class="contentList pad-10 hidden">
    <table width="100%" class="table_form ">
      <tr id="fmmb">
        <th width="200">栏目首页模板：</th>
        <td><select name="setting[category_template]" id="category_template">
            <option value="category.html">默认栏目首页：category.html</option>
            <volist name="tp_category" id="vo">
            <option value="{$vo}" <if condition="$data['setting']['category_template'] eq $vo ">selected</if>>{$vo}</option>
            </volist>
          </select> 新增模板以category_x.html形式</td>
      </tr>
      <tr>
        <th width="200">栏目列表：</th>
        <td><select name="setting[list_template]" id="list_template">
            <option value="list.html" >默认列表页：list.html</option>
            <volist name="tp_list" id="vo">
            <option value="{$vo}" <if condition="$data['setting']['list_template'] eq $vo ">selected</if>>{$vo}</option>
            </volist>
          </select>新增模板以list_x.html形式</td>
      </tr>
      <tr>
        <th width="200">栏目内容页：</th>
        <td><select name="setting[show_template]" id="show_template">
            <option value="show.html">默认内容页：show.html</option>
            <volist name="tp_show" id="vo">
            <option value="{$vo}" <if condition="$data['setting']['show_template'] eq $vo ">selected</if>>{$vo}</option>
            </volist>
          </select>新增模板以show_x.html形式</td>
      </tr>
    </table>
  </div>
  
  <div class="bk15"></div>
  <input name="catid" type="hidden" value="{$data.catid}">
  <input name="dosubmit" type="submit" value="提交" class="button">
  </div>
</div>
</form>
<!--table_form_off-->
<script language="JavaScript">
	window.top.$('#display_center_id').css('display','none');
	function SwapTab(name,cls_show,cls_hide,cnt,cur){
		for(i=1;i<=cnt;i++){
			if(i==cur){
				 $('#div_'+name+'_'+i).show();
				 $('#tab_'+name+'_'+i).attr('class',cls_show);
			}else{
				 $('#div_'+name+'_'+i).hide();
				 $('#tab_'+name+'_'+i).attr('class',cls_hide);
			}
		}
	}

</script>
</body>
</html>